class Restaurants::InfoController < Restaurants::RestaurantsController

  def show
    @nav_title = "店铺信息管理"
    add_breadcrumb create_nav(@nav_title,'#')
  end  

  def edit
    set_edit_breadcrumb
  end  

  def update
    if @restaurant.update_attributes(restaurant_params)
      redirect_to action: :show
    else
      set_edit_breadcrumb
      render :edit 
    end  
  end  

  def qrcode
    @nav_title = "店铺二维码"
    add_breadcrumb create_nav(@nav_title,'#')
  end

  def bulletion
    @nav_title = "店铺公告"
    add_breadcrumb create_nav(@nav_title,'#')
  end  
  
  def bulletion_edit
    set_edit_breadcrumb
  end



  private
  def set_edit_breadcrumb 
    @nav_title = "修改店铺信息"
    add_breadcrumb create_nav(@nav_title,'#')
  end 

  def set_bullet_breadcrumb
    @nav_title = "修改店铺"
    add_breadcrumb create_nav("店铺公告",'/restaurants/info/show')
    add_breadcrumb create_nav(@nav_title,'#')
  end  

  def restaurant_params
      params.require(:restaurant).permit(:name,:description,:attachment,:password,:phone,:address,:total_tables,:bulletion)
  end  
end
